Source: https://data.world/markmarkoh/kepler-confirmed-planets/workspace/project-summary?agentid=markmarkoh&datasetid=kepler-confirmed-planets NASA Exoplanet archive: https://exoplanetarchive.ipac.caltech.edu/docs/data.html
@Author: Javier Cebriรกn
@Attention: In this file there are Plotly (rendered with HTML) plots and equations. If you are viewing it with github, please enable external view with nbviewer
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
import plotly.graph_objects as go
import plotly.offline as pyo
sns.set()
planetsDf=pd.read_csv('../planets.csv',delimiter=',')
Orbit Period and Semi-major Axis is related with the following equation:
Where a=semi-major axis , T=period and ฮผ=MG with M=Mass of star and G=Gravity cte
planetsDf[['pl_orbsmax','pl_orbper']].corr()
| pl_orbsmax | pl_orbper | |
|---|---|---|
| pl_orbsmax | 1.000000 | 0.815671 |
| pl_orbper | 0.815671 | 1.000000 |
Whith scatter representacion can be observed that correlation value is affected by Oph 11 exoplanet outlier.
fig = px.scatter(x=planetsDf['pl_orbsmax'], y=planetsDf['pl_orbper'],title="Exoplanets: Orbital axis vs. period",width=800, height=320)
fig.update_xaxes(range=(0,300), title='Semi-major axis [AU]')
fig.update_yaxes(title='Period [days]')
fig.show()
Oph 11 is an outlier
planetsDf=planetsDf.drop(index=3183)
planetsDf[['pl_orbsmax','pl_orbper']].corr()
| pl_orbsmax | pl_orbper | |
|---|---|---|
| pl_orbsmax | 1.000000 | 0.965909 |
| pl_orbper | 0.965909 | 1.000000 |
fig = px.scatter(planetsDf,x='pl_orbsmax', y='pl_orbper',title="Exoplanets: Orbital axis vs. period",width=800, height=320)
fig.update_xaxes(range=(0,200), title='Semi-major axis [AU]')
fig.update_yaxes(title='Period [days]')
fig.show()
Applying the theory described at the beginning here is calculated the approximate result of the extrasolar planet's orbital period.
With a=semi-major axis , M=Mass of star and G=Gravity
a = 'pl_orbsmax' is the semi-major axis.
M = 'st_mass' is the mass star in solar masses.
4434075.792 is a factor to use solar masses and UA units
planetsDf=planetsDf[planetsDf['st_mass'].notnull()] #Erase data without star mass stimation
theorPeriod=np.power(planetsDf['pl_orbsmax'],3/2)/np.power(6.674E-11*(planetsDf['st_mass'])*4434075.792/(4*(np.power(np.pi,2))),1/2)
theorPeriod[planetsDf['pl_orbper'].isnull()]=np.nan
planetsDf['theorPeriod']=theorPeriod
data0 = go.Scatter(x=planetsDf['pl_orbsmax'], y=planetsDf['pl_orbper'], mode = 'markers', name='Measures')
data1 = go.Scatter(x=planetsDf['pl_orbsmax'], y=planetsDf['theorPeriod'], mode = 'markers', name='Theory')
data = [data0, data1]
layout = go.Layout(title='Observation Vs. Aproximation 1')
fig = go.Figure(data= data, layout = layout)
fig.update_xaxes(range=(0,200), title='Semi-major axis [AU]')
fig.update_yaxes(title='Period [days]')
fig.show()
#pyo.plot(fig, filename = 'line_chart.html')
Mean squared error:
((planetsDf['pl_orbper']-planetsDf['theorPeriod'])**2).mean()
721093.6716320177
More exactly:
With a=semi-major axis , M=Mass of star, m=mass of the planet and G=Gravity
a = 'pl_orbsmax' is the semi-major axis.
M = 'st_mass' is the mass star in solar masses.
4434075.792 is a factor to use solar masses and UA units
m = 'pl_bmassj' is the planet mass in Jupiter masses (Jupiter has $9.55ยท10^{-4}$ solar masses)
planetsDf=planetsDf[planetsDf['pl_bmassj'].notnull()] #Erase data without planet mass stimation
theorPeriod=np.power(planetsDf['pl_orbsmax'],3/2)/np.power(6.674E-11*(planetsDf['st_mass']+planetsDf['pl_bmassj']*9.55*10**-4)*4434075.792/(4*(np.power(np.pi,2))),1/2)
theorPeriod[planetsDf['pl_orbper'].isnull()]=np.nan
planetsDf['theorPeriod']=theorPeriod
data0 = go.Scatter(x=planetsDf['pl_orbsmax'], y=planetsDf['pl_orbper'], mode = 'markers', name='Measures')
data1 = go.Scatter(x=planetsDf['pl_orbsmax'], y=planetsDf['theorPeriod'], mode = 'markers', name='Theory')
data = [data0, data1]
layout = go.Layout(title='Observation Vs. Aproximation 2')
fig = go.Figure(data= data, layout = layout)
fig.update_xaxes(range=(0,100), title='Semi-major axis [AU]')
fig.update_yaxes(title='Period [days]')
fig.show()
#pyo.plot(fig, filename = 'line_chart.html')
Mean squared error:
((planetsDf['pl_orbper']-planetsDf['theorPeriod'])**2).mean()
30708.99206598928